
//
//  TabBarViewController.m
//  hello The traveler
//
//  Created by 贾帅 on 16/3/21.
//  Copyright © 2016年 hl. All rights reserved.
//

#import "TabBarViewController.h"
#import "BaseViewController.h"
#import "HLHomeTableViewController.h"
#import "WXQTableViewController.h"
#include "WDTableViewController.h"

@interface TabBarViewController ()

@end

@implementation TabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self setupUI];
}

- (void)setupUI {
    HLHomeTableViewController *vc1 = [[HLHomeTableViewController alloc] init];
    
    WDTableViewController *vc2 = [[WDTableViewController alloc] init];
    
    WXQTableViewController *vc3 = [[WXQTableViewController alloc] init];
    
    [self addChildViewController:vc1 withTitle:@"首页" withImageName:@"sy"];
    
    [self addChildViewController:vc3 withTitle:@"我想去" withImageName:@"wxq"];
    
    [self addChildViewController:vc2 withTitle:@"我的" withImageName:@"wd"];
    
}

- (void)addChildViewController:(UIViewController *)childController withTitle:(NSString *)title withImageName:(NSString *)name {

    self.tabBar.tintColor = [UIColor orangeColor];
    
    
    
    BaseViewController *nav = [[BaseViewController alloc] initWithRootViewController:childController]
    ;
    
    
    childController.title = title;
    
    
    NSString *nomalName = [NSString stringWithFormat:@"icon-sy-%@",name];
    
    NSString *selectName = [NSString stringWithFormat:@"icon-sy-dj%@",name];
    
    childController.tabBarItem.image  = [UIImage imageNamed:nomalName];
    
    childController.tabBarItem.selectedImage = [UIImage imageNamed:selectName];
    
    [self addChildViewController:nav];
    
}

@end
